package com.hauwei.huaweishop.service.impl;

import com.hauwei.huaweishop.dao.GoodinfosDao;
import com.hauwei.huaweishop.entity.Goodinfos;
import com.hauwei.huaweishop.service.GoodinfosService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Service实现类
 */
@Service
@Transactional
public class GoodinfosServiceImpl implements GoodinfosService {
    @Autowired
    private GoodinfosDao goodinfosDao;
    @Override
    public void addGoodinfos(Goodinfos goodinfos) {
        goodinfosDao.addGoodinfos(goodinfos);
    }

    @Override
    public void deleteGoodinfosByGid(Integer gid) {
        goodinfosDao.deleteGoodinfosByGid(gid);
    }

    @Override
    public void deleteGoodinfosByGname(String gname) {
        goodinfosDao.deleteGoodinfosByGname(gname);
    }

    @Override
    public void updateGoodinfos(Goodinfos goodinfos) {
        goodinfosDao.updateGoodinfos(goodinfos);
    }

    @Override
    @Transactional(propagation = Propagation.SUPPORTS)
    public List<Goodinfos> queryGoodinfosList() {
        return goodinfosDao.queryGoodinfosList();
    }

    @Override
    public List<Goodinfos> queryGoodinfosListByShoptypes(String name) {
        return goodinfosDao.queryGoodinfosListByShoptypes(name);
    }

    @Override
    public Goodinfos queryByGname(String gname) {
        return goodinfosDao.queryByGname(gname);
    }

    @Override
    public Goodinfos queryByGid(Integer gid) {
        return goodinfosDao.queryByGid(gid);
    }
}
